<?php
    include 'include/conf.php';
    $news_type = $db->selectAll('new_ty');
    $current_url = pathinfo($_SERVER['PHP_SELF'])['basename'];

    $ne_type = !isset($_GET['news_type']) ? '' : $_GET['news_type'];
    $ban_type = !isset($_GET['banner-type']) ? '' : $_GET['banner-type'];
//     pre($news_type);die;

?>


<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <title>CMS内容管理系统</title>
    <meta name="keywords" content="Admin">
    <meta name="description" content="Admin">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Core CSS  -->
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="css/glyphicons.min.css">

    <!-- Theme CSS -->
    <link rel="stylesheet" type="text/css" href="css/theme.css">
    <link rel="stylesheet" type="text/css" href="css/pages.css">
    <link rel="stylesheet" type="text/css" href="css/plugins.css">
    <link rel="stylesheet" type="text/css" href="css/responsive.css">

    <!-- Boxed-Layout CSS -->
    <link rel="stylesheet" type="text/css" href="css/boxed.css">

    <!-- Demonstration CSS -->
    <link rel="stylesheet" type="text/css" href="css/demo.css">

    <!-- Your Custom CSS -->
    <link rel="stylesheet" type="text/css" href="css/custom.css">

    <!-- Core Javascript - via CDN -->
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/uniform.min.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/custom.js"></script>
</head>

<body>
    <!-- Start: Header -->
    <header class="navbar navbar-fixed-top" style="background-image: none; background-color: rgb(240, 240, 240);">
        <div class="pull-left"> <a class="navbar-brand" href="#">
                <div class="navbar-logo"><img src="images/logo.png" alt="logo"></div>
            </a> </div>
        <div class="pull-right header-btns">
            <a class="user"><span class="glyphicons glyphicon-user"></span> admin</a>
            <a href="login.html" class="btn btn-default btn-gradient" type="button"><span class="glyphicons glyphicon-log-out"></span> 退出</a>
        </div>
    </header>
    <!-- End: Header -->

    <!-- Start: Main -->
    <div id="main">
        <!-- Start: Sidebar -->
        <aside id="sidebar" class="affix">
            <div id="sidebar-search">
                <div class="sidebar-toggle"><span class="glyphicon glyphicon-resize-horizontal"></span></div>
            </div>
            <div id="sidebar-menu">
                <ul class="nav sidebar-nav">
                    <li class="<?php if($current_url == 'index.php'){echo 'active';} ?>">
                        <a href="index.php"><span class="glyphicons glyphicon-home"></span><span class="sidebar-title">后台首页</span></a>
                    </li>

                    <li class="<?php if($current_url == 'news_list.php'){echo 'active';} ?>"> <a href="#sideEight" class="accordion-toggle <?php if($current_url == 'news_list.php'){echo 'menu-open';} ?>"><span class="glyphicons glyphicon-list"></span><span class="sidebar-title">新闻管理</span><span class="caret"></span></a>
                        <ul class="nav sub-nav" id="sideEight">
                             <li class="<?php if($ne_type == '' && $current_url == 'news_list.php'){echo 'active';} ?>"><a href="news_list.php"><span class="glyphicons glyphicon-record"></span> 所有新闻</a></li>
                            <?php foreach($news_type as $val){ ?>
                                <li class="<?php if($val['new_type_id'] == $ne_type){echo 'active';} ?>"><a href="news_list.php?news_type=<?php echo $val['new_type_id']; ?>"><span class="glyphicons glyphicon-record"></span> <?php echo $val['new_type_name']; ?></a></li>
                            <?php } ?>                            
                        </ul>
                    </li>
                    <li>
                        <a href="cate_list.php"><span class="glyphicons glyphicon-list"></span><span class="sidebar-title">文章分类管理</span></a>
                    </li>

                    
                    <li>
                        <a href="user_list.php"><span class="glyphicons glyphicon-list"></span><span class="sidebar-title">系统管理员</span></a>
                    </li>
                </ul>
            </div>
        </aside>
        <!-- End: Sidebar -->